﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.Messages;

namespace PMS.Data.EntityMap.Messages
{
    /// <summary>
    /// Represents a SMSAccount Mapping configuration
    /// </summary>
    public partial class SMSAccountMap : PMSEntityTypeConfiguration<SMSAccount>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<SMSAccount> builder)
        {
            builder.ToTable("msg_smsaccount");
            builder.HasKey(sms => sms.Id);

            builder.Property(sms => sms.SMSSenderName).HasMaxLength(128).IsRequired();
            builder.Property(sms => sms.SignName).HasMaxLength(128).IsRequired();
            builder.Property(sms => sms.MsgType).IsRequired();
            builder.Property(sms => sms.RegionID).HasMaxLength(128).IsRequired();
            builder.Property(sms => sms.AccessKeyId).HasMaxLength(128).IsRequired();
            builder.Property(sms => sms.AccessKeySecret).HasMaxLength(128).IsRequired();
            builder.Property(sms => sms.IsActive).IsRequired();

            builder.Ignore(sms => sms.CreatedOnTimeUtc);
            builder.Ignore(sms => sms.UpdatedOnTimeUtc);
            base.Configure(builder);
        }

        #endregion
    }
}
